Analysis for Neginhib (Ann Nordmeyer, Erica Yoon, Mike Frank). The study included three games designed to test the relationship between inhibitory control, implicature processing, and negation processing. All games had a similar structure: participants saw two pictures and heard a word, and had to select the picture that goes with the word as quickly as possible. Each game had two trial types, labeled control and target in these analyses. The three games were:

Inhibition Game : Participants saw several identical trials in a row (e.g. the word “apple” with pictures of an apple and a cookie) and then saw a trial with the same pictures but a different word (e.g. “cookie” with pictures of an apple and a cookie). The repeated trials in each run are the control trials and the final trial in each run was the target trial, designed to measure inhibitory control.

Implicature Game: On control / unambiguous trials, participants saw two single pictures (e.g. a picture of an apple and a picture of a cookie) and heard a word referring to one of the pictures (e.g. “apple”). On target / implicatures trials, participants saw a picture with a single item and a picture with the same item paired with another item (e.g. a picture of an apple, and a picture of an apple and a cookie) and heard e.g. “apple”. The “correct” response on these trials is the response generated by the ad-hoc implicature, e.g. that “apple” must refer to the single apple because otherwise the speaker would have said “cookie”.

Negation Game: On control / positive trials, participants saw two pictures and heard a word referring to one of the pictures (e.g. a picture of an apple and a picture of a cookie, with the word “apple”). On target / negative trials, participants saw two pictures and heard a word negating one of the pictures (e.g. a picture of an apple and a picture of a cookie, with the words “no apple”).

Kids played these games at the CDM on a computer (4, 5, and 6-year-olds), with 60 trials per game. Adults completed the task on MTurk, with 120 trials per game. The adult version of the task can be viewed here: https://langcog.stanford.edu/expts/EJY/neginhib/v1/turk/neginhib_mturk.html

Setting up

Load required Libraries

rm(list=ls())
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.3
library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
library(magrittr)
## 
## Attaching package: 'magrittr'
## 
## The following object is masked from 'package:tidyr':
## 
##     extract
library(RWiener)
library(knitr)
library(bootstrap)
library(gridExtra)
library(effsize)
library(lme4)
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## 
## The following object is masked from 'package:tidyr':
## 
##     expand
library(GGally)
## Warning: package 'GGally' was built under R version 3.2.3
## 
## Attaching package: 'GGally'
## 
## The following object is masked from 'package:dplyr':
## 
##     nasa

Some useful functions:

# number of unique subs
n.unique <- function (x) {
  length(unique(x))
}

# for bootstrapping 95% confidence intervals
theta <- function(x,xdata) {mean(xdata[x])}
ci.low <- function(x) {
  quantile(bootstrap(1:length(x),1000,theta,x)$thetastar,.025)}
ci.high <- function(x) {
  quantile(bootstrap(1:length(x),1000,theta,x)$thetastar,.975)}

Load in data

RT trimming: * Planned analysis: +/- 3SDs in log space * Post-hoc: also trim decisions < 200 ms from word onsent, > 15s (!) after offset, do this before planned outlier exclusion, doesn’t change the results but makes things more reasonable.

d.turk <- read.csv("../long_data/long_data_mturk.csv") 
n.turk.initial <- n.unique(d.turk$subid)

d.turk <- d.turk %>%
  # remove anyone who played fewer than 300 trials (means they did not complete at least half of the third game) or over 408 trials (means they completed the task twice, because 408 is max number of trials -- this only happened for one participant and I'm not sure how they were able to do this, so I'm rejecting them)
  mutate(subid = factor(subid)) %>%
  group_by(subid) %>%
  mutate(ntrials = n()) %>%
  filter(ntrials > 300 & ntrials < 408) %>%
  ungroup() %>%
  # create resp and rt vars
  mutate(resp = factor(response, levels=c("Y","N"), labels=c("upper","lower")), 
         q = rt/1000) %>%
  # remove outlier RTs
  filter(rt > 200, 
         rt < 15000) %>% # filtering the mysterious neg rt...
  filter(log(rt) < mean(log(rt)) + 3 * sd(log(rt)), 
         log(rt) > mean(log(rt)) - 3 * sd(log(rt))) %>%
  # clean up
  select(subid, game, trial.num, trial.type, q, resp) %>%
  mutate(agegroup = "adults") %>%
  ungroup() 
n.turk.final <- n.unique(d.turk$subid)

d.cdm.raw <- read.csv("../long_data/long_data_cdm.csv") %>%
  filter(agegroup == 4 | agegroup == 5 | agegroup == 6) 
n.cdm.initial <- n.unique(d.cdm.raw$subid)

d.cdm <- d.cdm.raw %>%
  # remove any child who played fewer than 150 trials (means they didn't complete at least half of the final game)
  group_by(subid) %>%
  mutate(ntrials = n()) %>%
  filter(ntrials > 150) %>%
  ungroup() %>%
  mutate(resp = factor(response, levels=c("Y","N"), labels=c("upper","lower")), 
         q = rt/1000) %>%
  # remove outlier RTs
  filter(rt > 200,
         rt < 15000) %>% # filtering the mysterious neg rt...
  filter(log(rt) < mean(log(rt)) + 3 * sd(log(rt)), 
         log(rt) > mean(log(rt)) - 3 * sd(log(rt))) %>%
  ungroup() 
m_age_comp <- aggregate(age ~ agegroup, d.cdm, mean)
min_age_comp <- aggregate(age ~ agegroup, d.cdm, min)
max_age_comp <- aggregate(age ~ agegroup, d.cdm, max)

d.cdm <- d.cdm %>%
  # clean up
  select(subid, age, agegroup, game, trial.num, trial.type, q, resp) %>%
  mutate(agegroup = factor(agegroup)) %>%
  ungroup() 
n.cdm.final <- n.unique(d.cdm$subid)
ns.cdm <- aggregate(subid ~ agegroup, d.cdm, n.unique)

d <- bind_rows(d.turk, d.cdm)

d$subid <- factor(d$subid)

d$agegroup <- factor(d$agegroup, levels = c("adults", "4", "5", "6"))

d$trial.labels <- factor(d$trial.type, levels = c("control", "inhib", "unambiguous", "implicature", "positive", "negative"))

d$correct <- as.numeric(as.character(factor(d$resp, 
                                            levels=c("upper","lower"), 
                                            labels=c("1","0"))))==1

d$trial.type <- factor(d$trial.type %in% c("inhib","implicature","negative"), 
                       levels = c(FALSE, TRUE), 
                       labels = c("control","target"))

d$game <- factor(d$game, levels=c("inhibition","implicature","negation"))

d <- d %>%
  mutate(agegroup2 = ifelse(agegroup == "adults", "adults", "kids"))

We excluded 2 adult participants and 24 child participants for failing to complete at least half of the trials in each game. This left a final sample of 48 adult participants and 66 child participants (22 4-year-olds (age range 4.01-4.99, mean age = 4.6), 19 5-year-olds (age range 5.03-5.95, mean age = 5.49), and 25 6-year-olds (age range 6-6.99, mean age = 6.46)).

Initial analysis

Proportion Correct

Proportion correct:

ms.acc <- d %>%
  group_by(game, trial.type, subid, agegroup) %>%
  summarise(m = mean(correct)) %>%
  group_by(game, trial.type, agegroup) %>%
  summarise(cih = ci.high(m),
            cil = ci.low(m),
            m = mean(m)) 
ms.acc$agegroup <- factor(ms.acc$agegroup, 
                      levels = c("4", "5", "6", "adults"), 
                      labels =  c("4", "5", "6", "Adults"))
ms.acc$trial.type <- factor(ms.acc$trial.type, labels = c("Control", "Target"))
ms.acc$game <- factor(ms.acc$game, labels = c("Inhibition", "Implicature", "Negation"))
ms.acc$kid <- ms.acc$agegroup != "Adults"

qplot(data = ms.acc, x = agegroup, y = m, color = trial.type, 
      geom = "point", position = position_dodge(.2)) + 
  geom_errorbar(aes(ymin = cil, ymax = cih), 
                position = position_dodge(.2), width = 0) + 
  geom_line(aes(group = interaction(kid,trial.type), col = trial.type)) + 
  facet_grid( ~ game) +
  ylab("Proportion correct") + xlab("Age Group") +
  scale_color_hue(name = "Trial Type") +
  theme_bw()

In general, both adults and kids have lower accuracy on target trials. Kids are much less accurate than adults on target trials, especially in the implicature and negation games.

Do kids differ from adults in accuracy?

##Inhibition: 
correct.inhib <- glmer(correct ~ trial.type * agegroup2 + (trial.type | subid), 
                             data = filter(d, game == "inhibition"), 
                             family = "binomial")
kable(summary(correct.inhib)$coefficients, digits = 3)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 4.486 0.189 23.753 0.000
trial.typetarget -2.090 0.198 -10.553 0.000
agegroup2kids -1.432 0.235 -6.100 0.000
trial.typetarget:agegroup2kids 0.603 0.242 2.491 0.013
##Implicature:
correct.imp <- glmer(correct ~ trial.type * agegroup2 + (trial.type | subid), 
                             data = filter(d, game == "implicature"),
                             family = "binomial")
kable(summary(correct.imp)$coefficients, digits = 3)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.371 0.156 21.565 0.000
trial.typetarget -1.142 0.215 -5.320 0.000
agegroup2kids -0.923 0.197 -4.692 0.000
trial.typetarget:agegroup2kids 0.114 0.276 0.415 0.678
##Negation: 
correct.neg <- glmer(correct ~ trial.type * agegroup2 + (trial.type | subid), 
                             data = filter(d, game == "negation"), 
                             family = "binomial")
kable(summary(correct.neg)$coefficients, digits = 3)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.746 0.158 17.366 0.000
trial.typetarget -0.179 0.276 -0.649 0.516
agegroup2kids 0.272 0.222 1.224 0.221
trial.typetarget:agegroup2kids -2.076 0.372 -5.583 0.000

Is there developmental change in accuracy from 4 to 6 years?

##Inhibition: 
correct.inhib.kids <- glmer(correct ~ trial.type * age + (trial.type | subid), 
                             data = filter(d, game == "inhibition",
                                           agegroup != "adults"), 
                             family = "binomial")
kable(summary(correct.inhib.kids)$coefficients, digits = 3)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.286 0.987 0.289 0.772
trial.typetarget 2.000 0.990 2.019 0.044
age 0.508 0.178 2.856 0.004
trial.typetarget:age -0.647 0.177 -3.657 0.000
##Implicature:
correct.imp.kids <- glmer(correct ~ trial.type * age + (trial.type | subid), 
                             data = filter(d, game == "implicature",
                                           agegroup != "adults"), 
                             family = "binomial")
kable(summary(correct.imp.kids)$coefficients, digits = 3)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.820 0.819 1.001 0.317
trial.typetarget -0.535 1.260 -0.425 0.671
age 0.294 0.146 2.006 0.045
trial.typetarget:age -0.089 0.225 -0.398 0.691
##Negation: 
correct.neg.kids <- glmer(correct ~ trial.type * age + (trial.type | subid), 
                             data = filter(d, game == "negation",
                                           agegroup != "adults"), 
                             family = "binomial")
kable(summary(correct.neg.kids)$coefficients, digits = 3)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.429 1.289 2.660 0.008
trial.typetarget -3.248 2.211 -1.469 0.142
age -0.044 0.226 -0.197 0.844
trial.typetarget:age 0.149 0.392 0.381 0.704

Reaction time

What about reaction time? Here we just look at RTs on correct trials (outlier RTs were trimmed earlier when the data was loaded).

#Plot data
ms.rt <- d %>%
  filter(correct == TRUE) %>%
  group_by(game, trial.type, subid, agegroup) %>%
  summarise(m = mean(q)) %>%
  group_by(game, trial.type, agegroup) %>%
  summarise(cih = ci.high(m),
            cil = ci.low(m),
            m = mean(m)) 
ms.rt$agegroup <- factor(ms.rt$agegroup, 
                      levels = c("4", "5", "6", "adults"), 
                      labels = c("4", "5", "6", "Adults"))
ms.rt$game <- factor(ms.rt$game, labels = c("Inhibition", "Implicature", "Negation"))
ms.rt$trial.type <- factor(ms.rt$trial.type, labels = c("Control", "Target"))

ms.rt$kid <- ms.rt$agegroup != "Adults"
qplot(data = ms.rt, x = agegroup, y = m, color = trial.type, 
      geom = "point", position = position_dodge(.2)) + 
  geom_errorbar(aes(ymin = cil, ymax = cih), 
                position = position_dodge(.2), width = 0) + 
  geom_line(aes(group = interaction(kid,trial.type), col = trial.type)) + 
  facet_grid( ~ game) +
  ylab("RT (s)") + xlab("Age Group") +
  scale_color_hue(name = "Trial Type") +
  theme_bw()

Are kids significantly slower than adults?

##Inhibition: 
rt.inhib <- lmer(q ~ trial.type * agegroup2 + (trial.type | subid), 
                             data = filter(d, game == "inhibition",
                                           correct == TRUE))
kable(summary(rt.inhib)$coefficients, digits = 3)
Estimate Std. Error t value
(Intercept) 0.641 0.034 18.880
trial.typetarget 0.140 0.014 9.757
agegroup2kids 0.639 0.045 14.228
trial.typetarget:agegroup2kids 0.092 0.023 3.972
##Implicature:
rt.imp <- lmer(q ~ trial.type * agegroup2 + (trial.type | subid), 
                             data = filter(d, game == "implicature",
                                           correct == TRUE))
kable(summary(rt.imp)$coefficients, digits = 3)
Estimate Std. Error t value
(Intercept) 0.933 0.045 20.577
trial.typetarget -0.011 0.029 -0.395
agegroup2kids 0.930 0.060 15.453
trial.typetarget:agegroup2kids -0.014 0.040 -0.354
##Negation: 
rt.neg <- lmer(q ~ trial.type * agegroup2 + (trial.type | subid), 
                             data = filter(d, game == "negation",
                                           correct == TRUE))
kable(summary(rt.neg)$coefficients, digits = 3)
Estimate Std. Error t value
(Intercept) 0.952 0.040 23.514
trial.typetarget 0.009 0.028 0.324
agegroup2kids 0.690 0.054 12.828
trial.typetarget:agegroup2kids 0.116 0.040 2.910

Do kids RTs change developmentally?

##Inhibition: 
rt.inhib.kids <- lmer(q ~ trial.type * age + (trial.type | subid), 
                             data = filter(d, game == "inhibition",
                                           agegroup != "adults", 
                                           correct == TRUE))
kable(summary(rt.inhib.kids)$coefficients, digits = 3)
Estimate Std. Error t value
(Intercept) 2.475 0.202 12.278
trial.typetarget 0.085 0.190 0.445
age -0.215 0.036 -5.994
trial.typetarget:age 0.026 0.034 0.781
##Implicature:
rt.imp.kids <- lmer(q ~ trial.type * age + (trial.type | subid), 
                             data = filter(d, game == "implicature",
                                           agegroup != "adults", 
                                           correct == TRUE))
kable(summary(rt.imp.kids)$coefficients, digits = 3)
Estimate Std. Error t value
(Intercept) 3.113 0.296 10.514
trial.typetarget -0.179 0.260 -0.687
age -0.225 0.053 -4.268
trial.typetarget:age 0.027 0.046 0.586
##Negation: 
rt.neg.kids <- lmer(q ~ trial.type * age + (trial.type | subid), 
                             data = filter(d, game == "negation",
                                           agegroup != "adults", 
                                           correct == TRUE))
kable(summary(rt.neg.kids)$coefficients, digits = 3)
Estimate Std. Error t value
(Intercept) 2.990 0.246 12.176
trial.typetarget 0.341 0.257 1.324
age -0.242 0.044 -5.549
trial.typetarget:age -0.038 0.045 -0.843

Individual Differences

Is there any correlation between an individual’s performance on one game vs. another game?

First let’s look at individual differences in accuracy for adults:

ms.acc.adults <- d %>%
  filter(agegroup2 == "adults") %>%
  group_by(subid, game, trial.type) %>%
  summarise(correct = mean(correct)) %>%
  spread(trial.type, correct) %>%
  mutate(sdiff = scale(target - control)) %>%
  select(-control, -target) %>%
  spread(game, sdiff)

ggpairs(data = ms.acc.adults, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.acc.adults$inhibition, ms.acc.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.acc.adults$inhibition and ms.acc.adults$implicature
## t = 1.4267, df = 46, p-value = 0.1604
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.08314126  0.46291482
## sample estimates:
##       cor 
## 0.2058565
cor.test(ms.acc.adults$inhibition, ms.acc.adults$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.acc.adults$inhibition and ms.acc.adults$negation
## t = -0.75017, df = 46, p-value = 0.457
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3821342  0.1798154
## sample estimates:
##        cor 
## -0.1099361
cor.test(ms.acc.adults$negation, ms.acc.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.acc.adults$negation and ms.acc.adults$implicature
## t = -1.0408, df = 46, p-value = 0.3034
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4178127  0.1384149
## sample estimates:
##        cor 
## -0.1516854

What about kids’ accuracy?

ms.acc.kids <- d %>%
  filter(agegroup2 == "kids") %>%
  group_by(subid, game, trial.type) %>%
  summarise(correct = mean(correct)) %>%
  spread(trial.type, correct) %>%
  mutate(sdiff = scale(target - control)) %>%
  select(-control, -target) %>%
  spread(game, sdiff)

ggpairs(data = ms.acc.kids, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.acc.kids$inhibition, ms.acc.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.acc.kids$inhibition and ms.acc.kids$implicature
## t = -0.70116, df = 64, p-value = 0.4857
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3225278  0.1580623
## sample estimates:
##        cor 
## -0.0873107
cor.test(ms.acc.kids$inhibition, ms.acc.kids$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.acc.kids$inhibition and ms.acc.kids$negation
## t = 0.66994, df = 64, p-value = 0.5053
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1618514  0.3190393
## sample estimates:
##        cor 
## 0.08345038
cor.test(ms.acc.kids$negation, ms.acc.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.acc.kids$negation and ms.acc.kids$implicature
## t = -0.3134, df = 64, p-value = 0.755
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2785385  0.2048286
## sample estimates:
##         cor 
## -0.03914474

Now let’s look at individual differences in reaction time for adults:

ms.rt.adults <- d %>%
  filter(correct == TRUE, agegroup2 == "adults") %>%
  group_by(subid, game, trial.type) %>%
  summarise(rt = mean(q)) %>%
  spread(trial.type, rt) %>%
  mutate(sdiff = scale(target - control)) %>%
  select(-control, -target) %>%
  spread(game, sdiff)

ggpairs(data = ms.rt.adults, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.rt.adults$inhibition, ms.rt.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.rt.adults$inhibition and ms.rt.adults$implicature
## t = -0.027447, df = 46, p-value = 0.9782
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2878505  0.2804103
## sample estimates:
##          cor 
## -0.004046784
cor.test(ms.rt.adults$inhibition, ms.rt.adults$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.rt.adults$inhibition and ms.rt.adults$negation
## t = 1.1787, df = 46, p-value = 0.2446
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1186789  0.4342378
## sample estimates:
##       cor 
## 0.1712298
cor.test(ms.rt.adults$negation, ms.rt.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.rt.adults$negation and ms.rt.adults$implicature
## t = 1.6619, df = 46, p-value = 0.1033
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.04948956  0.48905563
## sample estimates:
##       cor 
## 0.2379917

What about kids’ RT?

ms.rt.kids <- d %>%
  filter(correct == TRUE, agegroup2 == "kids") %>%
  group_by(subid, game, trial.type) %>%
  summarise(rt = mean(q)) %>%
  spread(trial.type, rt) %>%
  mutate(sdiff = scale(target - control)) %>%
  select(-control, -target) %>%
  spread(game, sdiff)

ggpairs(data = ms.rt.kids, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.rt.kids$inhibition, ms.rt.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.rt.kids$inhibition and ms.rt.kids$implicature
## t = 1.6442, df = 64, p-value = 0.105
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.04279977  0.42275234
## sample estimates:
##       cor 
## 0.2013185
cor.test(ms.rt.kids$inhibition, ms.rt.kids$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.rt.kids$inhibition and ms.rt.kids$negation
## t = 0.10134, df = 61, p-value = 0.9196
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2355476  0.2599041
## sample estimates:
##        cor 
## 0.01297461
cor.test(ms.rt.kids$negation, ms.rt.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.rt.kids$negation and ms.rt.kids$implicature
## t = 1.7939, df = 61, p-value = 0.07779
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.02531557  0.44683569
## sample estimates:
##       cor 
## 0.2238535

Diffusion Analysis

For the diffusion analysis, we estimated parameters separately for each trial type within each game. Parameters are estimated within each subject and then we aggregate across subjects to get means & confidence intervals on the parameters.

Plot densities

Plots show density of RTs for correct and incorrect responses, for each trial type. You can see the speed-accuracy tradeoff in some of these plots, especially the inhibition trials.

#Make a bunch of plots:
ggplot(d, aes(x = q)) + 
  geom_density(aes(group = resp, colour = resp, fill = resp), alpha = 0.3) +
  facet_grid(agegroup ~ game + trial.type, scales = "free") + 
  scale_fill_hue(labels = c("correct", "incorrect")) +
  scale_color_hue(labels = c("correct", "incorrect")) +
  theme_bw()

Estimating parameters

We calculated parameters for each trial type separately, within each subject. Then we aggregated across subjects to get means & confidence intervals on the parameters, and plotted the parameters across each game & trial type.

sub.pars <- data.frame(Separation = numeric(),
                       Non.Decision = numeric(),
                       Bias = numeric(),
                       Drift = numeric(),
                       Trial.Type = character(),
                       SubID = character(), 
                       Age = character())
sub.pars$Trial.Type <- as.character(sub.pars$Trial.Type)
sub.pars$SubID <- as.character(sub.pars$SubID)
sub.pars$Age <- as.character(sub.pars$Age)

temp.pars <- sub.pars

#because RWiener is finicky:
d$resp <- as.character(d$resp)
trialtypes <- c("control", "inhib", "unambiguous", "implicature", "positive", "negative")
subs <- unique(d$subid)

for (j in 1:length(subs)) {
  sid <- as.character(subs[j]) 
  for (i in 1:length(trialtypes)) {
    ttype <- as.character(trialtypes[i])
    dat <- as.data.frame(subset(d, trial.labels == ttype & subid == sid))
    opt <- optim(c(1, .1, .1, 1), wiener_deviance, 
                 dat=select(dat, c(q, resp)), method="Nelder-Mead")
    pars <- c(opt$par, ttype, sid, as.character(dat$agegroup[1]))
    temp.pars[i,] <- pars
  }
  sub.pars <- rbind(temp.pars, sub.pars)
  temp.pars <- temp.pars[0, ]
} 

Plot Parameters:

This plot shows the mean parameter values & 95% C.I.s for each game/trial type.

sub.pars <- sub.pars %>%
  mutate(Game = ifelse(Trial.Type == "control" | Trial.Type == "inhib", "inhibition", ifelse(Trial.Type == "positive" | Trial.Type == "negative", "negation", "implicature")), 
         Trial.Type = ifelse(Trial.Type == "control" | Trial.Type == "positive" | Trial.Type == "unambiguous", "Control", "Target"))

sub.pars$Separation <- as.numeric(sub.pars$Separation)
sub.pars$Non.Decision <- as.numeric(sub.pars$Non.Decision)
sub.pars$Bias <- as.numeric(sub.pars$Bias)
sub.pars$Drift <- as.numeric(sub.pars$Drift)
sub.pars$Kids <- sub.pars$Age != "adults"

sub.pars <- sub.pars %>% 
  group_by(Game, Kids) %>%
  filter(Separation < mean(Separation) + 3 * sd(Separation), 
         Separation > mean(Separation) - 3 * sd(Separation)) %>%
  filter(Non.Decision < mean(Non.Decision) + 3 * sd(Non.Decision), 
         Non.Decision > mean(Non.Decision) - 3 * sd(Non.Decision)) %>%
  filter(Bias < mean(Bias) + 3 * sd(Bias), 
         Bias > mean(Bias) - 3 * sd(Bias)) %>%
  filter(Drift < mean(Drift) + 3 * sd(Drift), 
         Drift > mean(Drift) - 3 * sd(Drift)) %>%
  ungroup() %>%
  na.omit()

sub.pars.ms <- sub.pars %>%
  gather(Param, Value, Separation:Drift) %>%
  group_by(Age, Trial.Type, Game, Param) %>%
  summarise(M = mean(Value),
            cih = ci.high(Value),
            cil = ci.low(Value))
sub.pars.ms$Game <- factor(sub.pars.ms$Game, levels = c("inhibition", "implicature", "negation"))

qplot(data = filter(sub.pars.ms), x = Age, color = Trial.Type,
      y = M, ymax=cih, ymin=cil, 
      geom = "pointrange", position = position_dodge(.25)) +
  facet_grid(Param ~ Game, scales = "free") +
  theme_bw()

Plot diffusion process:

We can also take these parameters and visualize the actual diffusion process for each game/trial type/age group:

#Visualize diffusion process for each game & trial type

games <- c("inhibition", "implicature", "negation")
age <- unique(sub.pars.ms$Age)
p <- list()

#graph axes
x <- 2
y <- 4

for (a in 1:length(age)) {
    for (g in 1:length(games)) {
    params <- sub.pars.ms %>%
      subset(Game == games[g] & Age == age[a]) %>%
      gather(Name, Value, M:cil) %>%
      unite(Stats, Param, Name) %>%
      spread(Stats, Value)
    params$yint_M = (params$Bias_M*params$Separation_M) - (params$Drift_M*params$Non.Decision_M)
    params$yint_cih = (params$Bias_M*params$Separation_M) - (params$Drift_cih*params$Non.Decision_M)
    params$yint_cil = (params$Bias_M*params$Separation_M) - (params$Drift_cil*params$Non.Decision_M)
    
    drift_ribbon <- data.frame(xvals = c(params$Non.Decision_M, #non-decision time
                                         (params$Separation_M - params$yint_cih) / params$Drift_cih, #Point where high drift line hits separation boundary
                                         (params$Separation_M - params$yint_M) / params$Drift_M, #Point where drift line hits separation boundary
                                         ifelse(params$Drift_cil > 0, (params$Separation_M - params$yint_cil) / params$Drift_cil, (0 - params$yint_cil) / params$Drift_cil)), #Point where low drift line hits separation boundary or 0
                               ymin = c(params$Bias_M * params$Separation_M, #point where drift starts
                                        params$Drift_cil*((params$Separation_M - params$yint_cih) / params$Drift_cih) + params$yint_cil, #point where low drift is when high drift ends
                                        params$Drift_cil*((params$Separation_M - params$yint_M) / params$Drift_M) + params$yint_cil, #point where low drift is when drift ends
                                        ifelse(params$Drift_cil > 0, params$Separation_M, 0)), #point where low drift ends
                               ymax = c(params$Bias_M * params$Separation_M, #point where drift starts
                                        params$Separation_M, #point where drift ends
                                         params$Separation_M, #point where drift ends
                                        params$Separation_M),#point where drift ends
                               Trial.Type = rep(params$Trial.Type, 4))
    
    nd_ribbon <- data.frame(xmin = params$Non.Decision_cil,
                            xmax = params$Non.Decision_cih,
                            ymin = rep(params$Bias_cil*params$Separation_cil, 2), 
                            ymax = rep(params$Bias_cih*params$Separation_cih, 2),
                            Trial.Type = params$Trial.Type)
    
    sep_ribbon <- data.frame(xmin = rep(c(0), 2),
                             xmax = rep(x, 2),
                             ymin = params$Separation_cil,
                             ymax = params$Separation_cih,
                             Trial.Type = params$Trial.Type)
    
    df <- data.frame()
    
    p[[g + 3*(a-1)]] <- ggplot(df) + coord_cartesian(xlim = c(0, x), ylim = c(0, y)) + 
      geom_point() +  theme_bw() +
      geom_segment(data = params, 
                   aes(x = Non.Decision_M, 
                       xend = (Separation_M - yint_M) / Drift_M,
                       y = Bias_M * Separation_M, yend = Separation_M, 
                       color = Trial.Type)) + 
      geom_rect(data = nd_ribbon,
                aes(xmin = xmin,
                    xmax = xmax,
                    ymin = ymin, 
                    ymax = ymax,
                    fill = Trial.Type), 
                alpha=0.2) +
      geom_ribbon(data = drift_ribbon, 
                  aes(x = xvals, 
                      ymin = ymin, 
                      ymax = ymax,
                      fill = Trial.Type), 
                  alpha=0.2) +
      geom_rect(data = sep_ribbon, 
                aes(xmin = xmin,
                    xmax = xmax,
                    ymin = ymin, 
                    ymax = ymax,
                    fill = Trial.Type), 
                alpha=0.2) +
      geom_hline(data = params, 
                 aes(yintercept = Separation_M, color = Trial.Type),
                 linetype = "dashed") + 
      geom_hline(yintercept = 0, linetype = "dashed") + 
      geom_vline(data = params, 
                 aes(xintercept = Non.Decision_M, color = Trial.Type)) + 
      scale_fill_discrete(guide = FALSE) +
      scale_color_discrete(guide = FALSE) +
      xlab("Time (seconds)") + ylab(paste("Boundary \n Separation")) #+ 
      #ggtitle(paste(age[a], ",", games[g], sep = " ")) 
  } 
}

plotlist <- c(list(p[[1]], p[[4]], p[[7]], p[[10]],  
                   p[[2]], p[[5]], p[[8]], p[[11]], 
                   p[[3]], p[[6]], p[[9]], p[[12]]), ncol = 4, nrow = 3)
do.call(grid.arrange, plotlist)

Pink = control trials and green = target trials (I removed the legend to make more space)

DDM Statistics

Parameter correlations

Are individual participants’ parameter values correlated across games?

ms.sep.adults <- sub.pars %>%
  filter(Age == "adults") %>%
  select(c(Separation, SubID, Trial.Type, Game)) %>%
  spread(Trial.Type, Separation)  %>%
  mutate(sdiff = scale(Target - Control)) %>%
  select(-Control, -Target) %>%
  spread(Game, sdiff)

ggpairs(data = ms.sep.adults, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.sep.adults$inhibition, ms.sep.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.sep.adults$inhibition and ms.sep.adults$implicature
## t = 0.17147, df = 40, p-value = 0.8647
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2791288  0.3283287
## sample estimates:
##        cor 
## 0.02710176
cor.test(ms.sep.adults$inhibition,ms.sep.adults$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.sep.adults$inhibition and ms.sep.adults$negation
## t = -1.2984, df = 39, p-value = 0.2018
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4810750  0.1110543
## sample estimates:
##        cor 
## -0.2035506
cor.test(ms.sep.adults$negation, ms.sep.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.sep.adults$negation and ms.sep.adults$implicature
## t = 0.54863, df = 40, p-value = 0.5863
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2233776  0.3803618
## sample estimates:
##        cor 
## 0.08642105
ms.sep.kids <- sub.pars %>%
  filter(Age != "adults") %>%
  select(c(Separation, SubID, Trial.Type, Game)) %>%
  spread(Trial.Type, Separation) %>%
  mutate(sdiff = scale(Target - Control)) %>%
  select(-Control, -Target) %>%
  spread(Game, sdiff)

ggpairs(data = ms.sep.kids, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.sep.kids$inhibition, ms.sep.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.sep.kids$inhibition and ms.sep.kids$implicature
## t = -1.7322, df = 53, p-value = 0.08905
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.46803186  0.03603344
## sample estimates:
##        cor 
## -0.2314766
cor.test(ms.sep.kids$inhibition,ms.sep.kids$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.sep.kids$inhibition and ms.sep.kids$negation
## t = 0.020141, df = 56, p-value = 0.984
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2557821  0.2608059
## sample estimates:
##         cor 
## 0.002691455
cor.test(ms.sep.kids$negation, ms.sep.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.sep.kids$negation and ms.sep.kids$implicature
## t = 0.47599, df = 55, p-value = 0.636
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1998521  0.3192899
## sample estimates:
##        cor 
## 0.06405103
ms.nd.adults <- sub.pars %>%
  filter(Age == "adults") %>%
  select(c(Non.Decision, SubID, Trial.Type, Game)) %>%
  spread(Trial.Type, Non.Decision) %>%
  mutate(sdiff = scale(Target - Control)) %>%
  select(-Control, -Target) %>%
  spread(Game, sdiff)

ggpairs(data = ms.nd.adults, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.nd.adults$inhibition, ms.nd.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.nd.adults$inhibition and ms.nd.adults$implicature
## t = 0.16999, df = 40, p-value = 0.8659
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2793441  0.3281203
## sample estimates:
##        cor 
## 0.02686844
cor.test(ms.nd.adults$inhibition,ms.nd.adults$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.nd.adults$inhibition and ms.nd.adults$negation
## t = 0.747, df = 39, p-value = 0.4595
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1960449  0.4113875
## sample estimates:
##       cor 
## 0.1187689
cor.test(ms.nd.adults$negation, ms.nd.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.nd.adults$negation and ms.nd.adults$implicature
## t = 1.027, df = 40, p-value = 0.3106
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1509996  0.4426547
## sample estimates:
##      cor 
## 0.160288
ms.nd.kids <- sub.pars %>%
  filter(Age != "adults") %>%
  select(c(Non.Decision, SubID, Trial.Type, Game)) %>%
  spread(Trial.Type, Non.Decision) %>%
  mutate(sdiff = scale(Target - Control)) %>%
  select(-Control, -Target) %>%
  spread(Game, sdiff)

ggpairs(data = ms.nd.kids, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.nd.kids$inhibition, ms.nd.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.nd.kids$inhibition and ms.nd.kids$implicature
## t = -1.1349, df = 53, p-value = 0.2615
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4028653  0.1160069
## sample estimates:
##        cor 
## -0.1540308
cor.test(ms.nd.kids$inhibition,ms.nd.kids$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.nd.kids$inhibition and ms.nd.kids$negation
## t = 1.3269, df = 56, p-value = 0.1899
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.08765764  0.41420776
## sample estimates:
##       cor 
## 0.1745912
cor.test(ms.nd.kids$negation, ms.nd.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.nd.kids$negation and ms.nd.kids$implicature
## t = -0.83033, df = 55, p-value = 0.4099
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3613576  0.1537589
## sample estimates:
##        cor 
## -0.1112666
ms.bias.adults <- sub.pars %>%
  filter(Age == "adults") %>%
  select(c(Bias, SubID, Trial.Type, Game)) %>%
  spread(Trial.Type, Bias) %>%
  mutate(sdiff = scale(Target - Control)) %>%
  select(-Control, -Target) %>%
  spread(Game, sdiff)

ggpairs(data = ms.bias.adults, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.bias.adults$inhibition, ms.bias.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.bias.adults$inhibition and ms.bias.adults$implicature
## t = -1.561, df = 40, p-value = 0.1264
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.50665142  0.06936482
## sample estimates:
##        cor 
## -0.2396182
cor.test(ms.bias.adults$inhibition,ms.bias.adults$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.bias.adults$inhibition and ms.bias.adults$negation
## t = 0.12334, df = 39, p-value = 0.9025
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2896631  0.3254205
## sample estimates:
##        cor 
## 0.01974707
cor.test(ms.bias.adults$negation, ms.bias.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.bias.adults$negation and ms.bias.adults$implicature
## t = 1.4616, df = 40, p-value = 0.1517
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.08455486  0.49520537
## sample estimates:
##       cor 
## 0.2251629
ms.bias.kids <- sub.pars %>%
  filter(Age != "adults") %>%
  select(c(Bias, SubID, Trial.Type, Game)) %>%
  spread(Trial.Type, Bias) %>%
  mutate(sdiff = scale(Target - Control)) %>%
  select(-Control, -Target) %>%
  spread(Game, sdiff)

ggpairs(data = ms.bias.kids, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.bias.kids$inhibition, ms.bias.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.bias.kids$inhibition and ms.bias.kids$implicature
## t = 0.68198, df = 53, p-value = 0.4982
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1763927  0.3499081
## sample estimates:
##       cor 
## 0.0932691
cor.test(ms.bias.kids$inhibition,ms.bias.kids$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.bias.kids$inhibition and ms.bias.kids$negation
## t = 1.54, df = 56, p-value = 0.1292
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.05984562  0.43710447
## sample estimates:
##       cor 
## 0.2015659
cor.test(ms.bias.kids$negation, ms.bias.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.bias.kids$negation and ms.bias.kids$implicature
## t = 0.79195, df = 55, p-value = 0.4318
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1587775  0.3568768
## sample estimates:
##       cor 
## 0.1061832
ms.drift.adults <- sub.pars %>%
  filter(Age == "adults") %>%
  select(c(Drift, SubID, Trial.Type, Game)) %>%
  spread(Trial.Type, Drift) %>%
  mutate(sdiff = scale(Target - Control)) %>%
  select(-Control, -Target) %>%
  spread(Game, sdiff)

ggpairs(data = ms.drift.adults, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.drift.adults$inhibition, ms.drift.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.drift.adults$inhibition and ms.drift.adults$implicature
## t = 0.37296, df = 40, p-value = 0.7111
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2495282  0.3564220
## sample estimates:
##        cor 
## 0.05886767
cor.test(ms.drift.adults$inhibition,ms.drift.adults$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.drift.adults$inhibition and ms.drift.adults$negation
## t = -0.62192, df = 39, p-value = 0.5376
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3947129  0.2151125
## sample estimates:
##         cor 
## -0.09909602
cor.test(ms.drift.adults$negation, ms.drift.adults$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.drift.adults$negation and ms.drift.adults$implicature
## t = -0.76513, df = 40, p-value = 0.4487
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4091003  0.1907936
## sample estimates:
##        cor 
## -0.1201022
ms.drift.kids <- sub.pars %>%
  filter(Age != "adults") %>%
  select(c(Drift, SubID, Trial.Type, Game)) %>%
  spread(Trial.Type, Drift) %>%
  mutate(sdiff = scale(Target - Control)) %>%
  select(-Control, -Target) %>%
  spread(Game, sdiff)

ggpairs(data = ms.drift.kids, 
        columns = 2:4, 
        upper = list(continuous = "cor"),
        lower = list(continuous = "smooth")) + 
  theme_bw()

cor.test(ms.drift.kids$inhibition, ms.drift.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.drift.kids$inhibition and ms.drift.kids$implicature
## t = -0.21047, df = 53, p-value = 0.8341
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2919574  0.2382250
## sample estimates:
##         cor 
## -0.02889854
cor.test(ms.drift.kids$inhibition,ms.drift.kids$negation)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.drift.kids$inhibition and ms.drift.kids$negation
## t = 0.31695, df = 56, p-value = 0.7525
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2183660  0.2973621
## sample estimates:
##        cor 
## 0.04231654
cor.test(ms.drift.kids$negation, ms.drift.kids$implicature)
## 
##  Pearson's product-moment correlation
## 
## data:  ms.drift.kids$negation and ms.drift.kids$implicature
## t = 0.94977, df = 55, p-value = 0.3464
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1381098  0.3751786
## sample estimates:
##       cor 
## 0.1270292

Adult data t-tests

Some t-tests to compare parameter values across trial types for adults in different games.

sub.pars$Age <- factor(sub.pars$Age, levels = c("adults", "4", "5", "6"))
sub.pars$Trial.Type <- factor(sub.pars$Trial.Type)

#adult t tests
inhib.bias <- sub.pars %>%
  filter(Age == "adults", Game == "inhibition") %>%
  select(Bias, SubID, Trial.Type) %>%
  spread(Trial.Type, Bias)

t.test(inhib.bias$Control, inhib.bias$Target, paired = T)
## 
##  Paired t-test
## 
## data:  inhib.bias$Control and inhib.bias$Target
## t = 4.9146, df = 43, p-value = 1.338e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.09938123 0.23770079
## sample estimates:
## mean of the differences 
##                0.168541
inhib.nd <- sub.pars %>%
  filter(Age == "adults", Game == "inhibition") %>%
  select(Non.Decision, SubID, Trial.Type) %>%
  spread(Trial.Type, Non.Decision)

t.test(inhib.nd$Control, inhib.nd$Target, paired = T)
## 
##  Paired t-test
## 
## data:  inhib.nd$Control and inhib.nd$Target
## t = -9.3618, df = 43, p-value = 6.144e-12
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.1669209 -0.1077518
## sample estimates:
## mean of the differences 
##              -0.1373363
imp.sep <- sub.pars %>%
  filter(Age == "adults", Game == "implicature") %>%
  select(Separation, SubID, Trial.Type) %>%
  spread(Trial.Type, Separation)

t.test(imp.sep$Control, imp.sep$Target, paired = T)
## 
##  Paired t-test
## 
## data:  imp.sep$Control and imp.sep$Target
## t = 4.2129, df = 44, p-value = 0.000123
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.2223478 0.6301862
## sample estimates:
## mean of the differences 
##                0.426267
imp.drift <- sub.pars %>%
  filter(Age == "adults", Game == "implicature") %>%
  select(Drift, SubID, Trial.Type) %>%
  spread(Trial.Type, Drift)

t.test(imp.drift$Control, imp.drift$Target, paired = T)
## 
##  Paired t-test
## 
## data:  imp.drift$Control and imp.drift$Target
## t = 7.1506, df = 44, p-value = 6.88e-09
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.8029908 1.4332671
## sample estimates:
## mean of the differences 
##                1.118129
neg.drift <- sub.pars %>%
  filter(Age == "adults", Game == "negation") %>%
  select(Drift, SubID, Trial.Type) %>%
  spread(Trial.Type, Drift)

t.test(neg.drift$Control, neg.drift$Target, paired = T)
## 
##  Paired t-test
## 
## data:  neg.drift$Control and neg.drift$Target
## t = 0.80172, df = 43, p-value = 0.4271
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.1117470  0.2592219
## sample estimates:
## mean of the differences 
##              0.07373745
neg.nd <- sub.pars %>%
  filter(Age == "adults", Game == "negation") %>%
  select(Non.Decision, SubID, Trial.Type) %>%
  spread(Trial.Type, Non.Decision)

t.test(neg.nd$Control, neg.nd$Target, paired = T)
## 
##  Paired t-test
## 
## data:  neg.nd$Control and neg.nd$Target
## t = 5.6812, df = 43, p-value = 1.062e-06
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.04892255 0.10276989
## sample estimates:
## mean of the differences 
##              0.07584622

General Developmental Change

Do children’s parameter values change across development, regardless of game?

#Look at changes in paramaters in general across age: 
sep.model <- lm(Separation ~ Age, data = sub.pars)
kable(summary(sep.model)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.793 0.057 31.613 0
Age4 1.085 0.102 10.638 0
Age5 1.152 0.107 10.794 0
Age6 0.740 0.096 7.682 0
nd.model <- lm(Non.Decision ~ Age, data = sub.pars)
kable(summary(nd.model)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.486 0.014 34.835 0
Age4 0.177 0.025 7.038 0
Age5 0.176 0.026 6.689 0
Age6 0.097 0.024 4.082 0
bias.model <- lm(Bias ~ Age, data = sub.pars)
kable(summary(bias.model)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.427 0.009 48.899 0.000
Age4 0.049 0.016 3.118 0.002
Age5 0.017 0.016 1.034 0.301
Age6 -0.015 0.015 -0.983 0.326
drift.model <- lm(Drift ~ Age, data = sub.pars)
kable(summary(drift.model)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.491 0.057 44.068 0
Age4 -1.634 0.102 -16.080 0
Age5 -1.222 0.106 -11.486 0
Age6 -1.125 0.096 -11.724 0
#Look at continuous across age group, just children
sub.pars.cont <- filter(sub.pars, Age != "adults")
sub.pars.cont$Age <- as.numeric(as.character(sub.pars.cont$Age))

cont.sep.model <- lm(Separation ~ Age, data = sub.pars.cont)
kable(summary(cont.sep.model)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.666 0.348 10.538 0.000
Age -0.178 0.068 -2.630 0.009
cont.nd.model <- lm(Non.Decision ~ Age, data = sub.pars.cont)
kable(summary(cont.nd.model)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.838 0.090 9.361 0.00
Age -0.041 0.017 -2.342 0.02
cont.bias.model <- lm(Bias ~ Age, data = sub.pars.cont)
kable(summary(cont.bias.model)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.602 0.049 12.36 0.000
Age -0.032 0.009 -3.34 0.001
cont.drift.model <- lm(Drift ~ Age, data = sub.pars.cont)
kable(summary(cont.drift.model)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.097 0.256 -0.378 0.705
Age 0.251 0.050 5.028 0.000

Developmental Change across games

Does children’s development look different in different games?

##inhibition game
inhib <- filter(sub.pars, Game == "inhibition")

inhib.sep <- lm(Separation ~ Age * Trial.Type, data = inhib)
kable(summary(inhib.sep)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.966 0.122 16.073 0.000
Age4 0.664 0.220 3.015 0.003
Age5 1.139 0.228 4.995 0.000
Age6 0.625 0.210 2.974 0.003
Trial.TypeTarget -0.026 0.175 -0.148 0.883
Age4:Trial.TypeTarget -0.048 0.318 -0.151 0.880
Age5:Trial.TypeTarget -0.372 0.330 -1.128 0.260
Age6:Trial.TypeTarget -0.325 0.297 -1.097 0.274
inhib.nd <- lm(Non.Decision ~ Age * Trial.Type, data = inhib)
kable(summary(inhib.nd)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.322 0.028 11.451 0.000
Age4 0.040 0.051 0.801 0.424
Age5 -0.014 0.052 -0.268 0.789
Age6 0.021 0.048 0.441 0.659
Trial.TypeTarget 0.133 0.040 3.319 0.001
Age4:Trial.TypeTarget 0.153 0.073 2.092 0.038
Age5:Trial.TypeTarget 0.191 0.076 2.518 0.013
Age6:Trial.TypeTarget 0.115 0.068 1.682 0.094
inhib.bias <- lm(Bias ~ Age * Trial.Type, data = inhib)
kable(summary(inhib.bias)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.469 0.023 20.254 0.000
Age4 -0.032 0.042 -0.763 0.446
Age5 -0.017 0.043 -0.392 0.695
Age6 0.005 0.040 0.115 0.909
Trial.TypeTarget -0.167 0.033 -5.043 0.000
Age4:Trial.TypeTarget 0.136 0.060 2.263 0.025
Age5:Trial.TypeTarget 0.057 0.063 0.907 0.365
Age6:Trial.TypeTarget -0.057 0.056 -1.016 0.311
inhib.drift <- lm(Drift ~ Age * Trial.Type, data = inhib)
kable(summary(inhib.drift)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.119 0.126 24.695 0.000
Age4 -1.954 0.227 -8.597 0.000
Age5 -1.565 0.235 -6.648 0.000
Age6 -1.417 0.217 -6.523 0.000
Trial.TypeTarget 0.515 0.181 2.850 0.005
Age4:Trial.TypeTarget -0.475 0.328 -1.448 0.149
Age5:Trial.TypeTarget -0.278 0.341 -0.816 0.416
Age6:Trial.TypeTarget -0.322 0.306 -1.053 0.294
##implicature game
imp <- filter(sub.pars, Game == "implicature")

imp.sep <- lm(Separation ~ Age * Trial.Type, data = imp)
kable(summary(imp.sep)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.969 0.133 14.838 0.000
Age4 1.134 0.237 4.785 0.000
Age5 1.385 0.250 5.535 0.000
Age6 0.852 0.224 3.810 0.000
Trial.TypeTarget -0.433 0.187 -2.318 0.021
Age4:Trial.TypeTarget -0.028 0.332 -0.084 0.933
Age5:Trial.TypeTarget -0.324 0.357 -0.908 0.365
Age6:Trial.TypeTarget -0.150 0.320 -0.469 0.640
imp.nd <- lm(Non.Decision ~ Age * Trial.Type, data = imp)
kable(summary(imp.nd)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.531 0.029 18.035 0.000
Age4 0.136 0.053 2.580 0.011
Age5 0.254 0.056 4.568 0.000
Age6 0.155 0.050 3.122 0.002
Trial.TypeTarget 0.007 0.041 0.165 0.869
Age4:Trial.TypeTarget 0.052 0.074 0.707 0.480
Age5:Trial.TypeTarget 0.025 0.079 0.314 0.754
Age6:Trial.TypeTarget -0.026 0.071 -0.372 0.710
imp.bias <- lm(Bias ~ Age * Trial.Type, data = imp)
kable(summary(imp.bias)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.420 0.018 23.934 0.000
Age4 0.028 0.031 0.899 0.370
Age5 0.085 0.033 2.576 0.011
Age6 0.017 0.030 0.573 0.567
Trial.TypeTarget 0.048 0.025 1.938 0.054
Age4:Trial.TypeTarget -0.007 0.044 -0.158 0.875
Age5:Trial.TypeTarget -0.091 0.047 -1.928 0.055
Age6:Trial.TypeTarget -0.052 0.042 -1.239 0.217
imp.drift <- lm(Drift ~ Age * Trial.Type, data = imp)
kable(summary(imp.drift)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.697 0.095 28.535 0.000
Age4 -1.755 0.169 -10.395 0.000
Age5 -1.486 0.178 -8.336 0.000
Age6 -1.276 0.159 -8.010 0.000
Trial.TypeTarget -1.063 0.133 -7.993 0.000
Age4:Trial.TypeTarget 0.627 0.236 2.652 0.009
Age5:Trial.TypeTarget 0.795 0.254 3.127 0.002
Age6:Trial.TypeTarget 0.494 0.228 2.168 0.031
##negation game
neg <- filter(sub.pars, Game == "negation")

neg.sep <- lm(Separation ~ Age * Trial.Type, data = neg)
kable(summary(neg.sep)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.602 0.147 10.890 0.000
Age4 1.992 0.267 7.455 0.000
Age5 1.672 0.272 6.143 0.000
Age6 1.469 0.248 5.927 0.000
Trial.TypeTarget 0.147 0.208 0.705 0.481
Age4:Trial.TypeTarget -0.985 0.375 -2.629 0.009
Age5:Trial.TypeTarget -0.828 0.385 -2.152 0.033
Age6:Trial.TypeTarget -1.005 0.351 -2.867 0.005
neg.nd <- lm(Non.Decision ~ Age * Trial.Type , data = neg)
kable(summary(neg.nd)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.572 0.031 18.565 0.000
Age4 0.198 0.056 3.541 0.000
Age5 0.102 0.057 1.796 0.074
Age6 0.006 0.052 0.107 0.915
Trial.TypeTarget -0.074 0.044 -1.692 0.092
Age4:Trial.TypeTarget 0.104 0.079 1.327 0.186
Age5:Trial.TypeTarget 0.171 0.081 2.124 0.035
Age6:Trial.TypeTarget 0.124 0.073 1.683 0.094
neg.bias <- lm(Bias ~ Age * Trial.Type, data = neg)
kable(summary(neg.bias)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.466 0.018 26.455 0.000
Age4 0.123 0.032 3.852 0.000
Age5 -0.006 0.033 -0.179 0.858
Age6 0.004 0.030 0.146 0.884
Trial.TypeTarget -0.037 0.025 -1.495 0.136
Age4:Trial.TypeTarget -0.072 0.045 -1.614 0.108
Age5:Trial.TypeTarget 0.010 0.046 0.222 0.824
Age6:Trial.TypeTarget -0.021 0.042 -0.498 0.619
neg.drift <- lm(Drift ~ Age * Trial.Type, data = neg)
kable(summary(neg.drift)$coefficients, digits = 3)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.010 0.114 17.641 0.000
Age4 -0.990 0.207 -4.781 0.000
Age5 -0.352 0.211 -1.669 0.097
Age6 -0.381 0.192 -1.984 0.049
Trial.TypeTarget -0.130 0.161 -0.805 0.421
Age4:Trial.TypeTarget -0.534 0.290 -1.838 0.067
Age5:Trial.TypeTarget -1.055 0.298 -3.541 0.000
Age6:Trial.TypeTarget -0.834 0.272 -3.072 0.002